package cn.lg.soar.system.api.utils;

import cn.lg.soar.core.util.SoarSubscriber;
import cn.lg.soar.system.api.service.ICaptchaApi;

/**
 * 验证码工具
 * @author luguoxiang
 * @date 2025-07-15
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class CaptchaUtils {

    private static ICaptchaApi api;
    static {
        SoarSubscriber.subscribeInit(applicationContext -> {
            api = applicationContext.getBean(ICaptchaApi.class);
        });
    }

    /**
     * 获取图形验证码
     * @return
     */
    public static String getCaptcha(String bizType) {
        return api.getCaptcha(bizType);
    }

    /**
     * 验证图形验证码
     * @param code
     * @return
     */
    public static boolean checkCaptcha(String bizType, String code) {
        return api.checkCaptcha(bizType, code);
    }


}
